package com.hs.dynamic.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hs.dynamic.dto.req.UserReq;
import com.hs.dynamic.entity.User;
import com.hs.dynamic.mapper.UserMapper;
import com.hs.dynamic.service.UserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description: TODO
 * @Author 胡尚
 * @Date: 2024/8/2 10:11
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public int addUser(UserReq req) {
        User user = new User();
        // 对象转换
        BeanUtils.copyProperties(req,user);

        int insertCount = userMapper.insert(user);
        return insertCount;
    }
}
